//
//  DIYFSCalendar.swift
//  GreenDeal
//
//  Created by Moennig Q on 2023/4/17.
//

import Foundation
import FSCalendar
class DIYFSCalendar: FSCalendar {
    override init(frame: CGRect) {
        super.init(frame: frame)
    }
    //MARK: - 注册粘性Header（可滚动的日历），
    func registerHeader(_ headerClass: AnyClass, forHeaderReuseIdentifier: String){
        if headerClass.isSubclass(of: FSCalendarStickyHeader.self) {

        }
        self.collectionView.register(DIYFSCalendarStickerHeader.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "header")
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
//MARK: - 自定义header view
class DIYFSCalendarStickerHeader: FSCalendarStickyHeader{
    override func layoutSubviews() {
        super.layoutSubviews()
        self.titleLabel.backgroundColor = UIColor(hexStr: "#005D2D1A")
        //以下是给hear画圆角
//        let path = UIBezierPath(roundedRect: self.titleLabel.bounds, byRoundingCorners: [.topLeft,.topRight], cornerRadii: CGSize(width: 6, height: 6))
//        let maskLayer = CAShapeLayer()
//        maskLayer.frame = self.titleLabel.bounds
//        maskLayer.path = path.cgPath
//        self.titleLabel.layer.mask = maskLayer
    }
}
